{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item" >

                        <div class="layui-input-inline">
                            <input type="text" id="repair_username" class="layui-input search" name="repair_username" placeholder="上报用户名" />
                        </div>

                        <div class="layui-input-inline">
                            <input type="text" id="repair_done_username" class="layui-input search" name="repair_done_username" placeholder="管理员用户名" />
                        </div>

                        <div class="layui-input-inline">
                            <input type="text" id="repair_done_phone" class="layui-input search" name="repair_done_phone" placeholder="管理员手机号" />
                        </div>

                        <div class="layui-input-inline layui-form">
                            <select name="repair_type" id="repair_type" lay-search="">
                                <option  value="">不限类型</option>
                                {foreach name="repair_type" item="vo"}
                                <option  value="{$vo.rt_id}">{$vo.rt_name}</option>
                                {/foreach}
                            </select>
                        </div>

                        <div class="layui-input-inline layui-form">
                            <select name="repair_plot" id="repair_plot" lay-search="">
                                <option  value="">不限小区</option>
                                {foreach name="plot" item="vv"}
                                <option  value="{$vv.xq_id}">{$vv.xq_name}</option>
                                {/foreach}
                            </select>
                        </div>

                        <div class="layui-input-inline" style="margin-top: 5px;">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                    <!--<div class="input-group" >-->
                        <!--<button class="btn btn-primary" type="button" onclick="wk.href('{:url('typeAdd')}');">-->
                            <!--<i class="fa fa-plus"></i> 添加分类-->
                        <!--</button>-->
                    <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>

                    <!--状态显示模板-->
                    <script type="text/html" id="repairSta">
                        {{# if(d.repair_status == 1){ }}
                        待处理
                        {{# } }}
                        {{# if(d.repair_status == 2){ }}
                        处理中
                        {{# } }}
                        {{# if(d.repair_status == 3){ }}
                        处理完成
                        {{# } }}
                    </script>

                    <script type="text/html" id="rcType">
                        {{# if(d.rc_type == 1){ }}
                        满意
                        {{# } }}
                        {{# if(d.rc_type == 2){ }}
                        一般
                        {{# } }}
                        {{# if(d.rc_type == 3){ }}
                        不满意
                        {{# } }}
                    </script>

                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a href="javascript:;" onclick="wk.layer_show('详情','{:url('repairDetail')}?repair_id={{d.repair_id}}')" class="btn btn-warning btn-xs m-r-xs" title="详情"><i class="fa fa-search">详情</i></a>
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Repair/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                {type: 'checkbox', fixed: 'left',}
                {type:'numbers', width: 60, title: '序号'}
                , {field: 'user_username', width: '', title: '上报用户', align: 'center'}
                , {field: 'xq_name', width: '', title: '上报小区', align: 'center'}
                , {field: 'repair_phone', width: 120, title: '联系方式', align: 'center'}
                , {field: 'rt_name', width: '', title: '上报类型', align: 'center'}
                , {field: 'repair_addr', width: '', title: '事件位置', align: 'center'}
                , {field: 'repair_explain', width: '', title: '上报说明', align: 'center'}
                , {field: 'repair_status', width: 100, title: '处理状态', align: 'center', toolbar: '#repairSta'}
                , {field: 'repair_time', width: 160, title: '上报时间', align: 'center'}
                , {field: 'done_username', width: '', title: '管理员名称', align: 'center'}
                , {field: 'done_user_phone', width: 120, title: '管理员手机号', align: 'center'}
                , {field: 'rc_content', width: '', title: '评价', align: 'center'}
                , {field: 'rc_type', width: 90, title: '评价标签', align: 'center', toolbar: '#rcType'}
                , {fixed: 'right', width: 120, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });

        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['repair_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>